<?php

class Count {	
	public function accounts() {
		$result = Mssql::fetch('SELECT COUNT(1) AS total FROM MEMB_INFO');
		return $result->total;
	}
	
	public function characters() {
		$result = Mssql::fetch('SELECT COUNT(1) AS total FROM Character');
		return $result->total;
	}
	
	public function guilds() {
		$result = Mssql::fetch('SELECT COUNT(1) AS total FROM Guild');
		return $result->total;
	}
	
	public function characters_by_class($class) {
		$result = Mssql::fetch('SELECT COUNT(1) AS total FROM Character WHERE Class = :class[integer]', array('class' => $class));
		return $result->total;
	}
	
	public function banned_accounts() {
		$result = Mssql::fetch('SELECT COUNT(1) AS total FROM MEMB_INFO WHERE bloc_code = 1');
		return $result->total;		
	}
	
	public function banned_characters() {
		$result = Mssql::fetch('SELECT COUNT(1) AS total FROM Character WHERE CtlCode = 1');
		return $result->total;		
	}
	
	public function onlines() {
		$result = Mssql::fetch('SELECT COUNT(1) AS total FROM MEMB_STAT WHERE ConnectStat > 0');
		return $result->total;		
	}
	
	public function onlines_by_server($server = null) {
		$result = Mssql::fetch('SELECT COUNT(1) AS total FROM MEMB_STAT WHERE ConnectStat > 0 AND ServerName = :server[string]', array('server' => $server));
		return $result->total;		
	}
}

?>